package cn.tedu.spring.di;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 测试类
 */
public class TestUserDao {
    public static void main(String[] args) {
        /*
            1.创建Spring Bean对象,并存入IoC容器中[ApplicationContext接口];
            2.从IoC容器中获取Spring Bean对象[getBean(类型.class)];
            3.打印测试;
         */
        ApplicationContext context = new AnnotationConfigApplicationContext("cn.tedu.spring.di");
        UserService userService = context.getBean(UserService.class);
        System.out.println(userService);
    }
}
